<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<title>招标公告</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/datatable.noborder.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.dataTables.chs.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/api.js"></script>
<script type="text/javascript">
$(function() {
	var urlPrefix = "${pageContext.request.contextPath}/api/";
	var category = ${category};
	
	if (category == 1) {
	    $('#news_notice_type_name').text('新闻通告');
	} else if (category == 2) {
	    $('#news_notice_type_name').text('入围公告');
	} else if (category == 3) {
	    $('#news_notice_type_name').text('中标公告');
	} else if (category == 4) {
	    $('#news_notice_type_name').text('招标公告');
	} else if (category == 5) {
	    $('#news_notice_type_name').text('招标预告');
	}
	
    var table = $('#news_notice').DataTable({
		paging: true,
		pageLength: 15,
		pagingType: 'full_numbers',
		lengthChange: false,
		searching: false,
		info: true,
		ordering: false,
		autoWidth: false,
		columns: [
			{data:'title', width:'70%', className: 'dt-body-left', render: function(data, type, full, meta) {
			    return '<a href="${pageContext.request.contextPath}/forward/news_notice_detail?newsNoticeId=' + full.news_notice_id + '" target="_blank">' + "&bull;&nbsp;" + data + '</a>';
			}},
			{data:'create_date', width:'30%', className: 'dt-body-right', render: function(data, type, full, meta) {
			    return data.substr(0, 10);
			}}
		],
		serverSide: true,
		processing: true,
		ajax: {
			url: '${pageContext.request.contextPath}/api/NewsNoticeSearchAPI.json',
			type: 'POST',
			data: function(d) {
			    var paramData = {};
			    paramData.category = category;
			    if ($('#keyword').val()) {
		            paramData.title = $('#keyword').val();
			    }
		        if ($('#time_limit').val()) {
		            paramData.time_limit = $('#time_limit').val();
		        } else {
		            paramData.time_limit = 1;
		        }
			    d.param = JSON.stringify(paramData);
			},
			dataSrc: 'news_notice'
		}
	});
    
	$.codeNameCombo({
        urlPrefix: urlPrefix,
        typeId: '12',
        target: '#time_limit',
        value: '1',
        onChange: function(newValue, oldValue) {
        }
    });

 	$('#btn_notice_search').click(function() {
        table.ajax.reload();
    });
	
});
</script>
</head>
<body>
  <div style="text-align: center;" align="center">
    <jsp:include page="top.jsp" />   
    <div id="notice_content" style="width: 1000px; height: 600px; margin: 0 auto; margin-top: 10px; border:1px ;"> 
      <div id="notice_area" style="width: 700px; height: 600px; margin: 0 auto; border:1px solid #eee; float:left; text-align: center; vertical-align: middle;">
        <div id="news_notice_type_name" style="padding: 5px; border-bottom:1px solid #eee; font-size: 15px; text-align: left; font-weight: bold; font-style: italic; text-shadow: 2px 2px 1px #ccc;">招标公告</div>
        <div>
          <table id="news_notice" class=""></table>
        </div>
      </div>
      <div id="notice_search_area" style="width: 290px; height: 600px; margin: 0 auto; border:1px solid #eee; float:right; text-align: center; vertical-align: middle;">
        <div style="padding: 5px; border-bottom:1px solid #eee; font-size: 15px; text-align: center; font-weight: bold; font-style: italic; text-shadow: 2px 2px 1px #ccc;">公告检索</div>
        <div style="margin-top: 30px; font-size: 15px;">关键字<input type="text" id="keyword" style="width: 170px; margin-left: 10px;"></div>
        <div style="margin-top: 25px; font-size: 15px;" >发布日<select id="time_limit" style="height: 30px; margin-left: 10px; width: 190px;"></select></div>
        <div style="margin-top: 25px;" ><button type="button" id="btn_notice_search" style="width: 100px; height: 27px;">搜索</button></div>
      </div>
    </div>
    <div id="footer"  style="padding-bottom: 5px;"><s:text name="copyright" /></div>
  </div>
  
</body>
</html>
